﻿@model abc.Models.State
@{
    ViewBag.Title = "ShowState";
    Layout = "~/Views/Shared/_LayoutPageAdmin.cshtml";
}

<div class="col-md-12">

    <div class="box box-info">
        <div class="box-header with-border">
            <h3 class="box-title">States</h3>
            <div class="box-tools pull-right">
                <button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
                <button class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
            </div>
        </div>

        <div class="box-body">
            <div class="table-responsive">
                <table class="table no-margin">
                    <thead>
                        <tr>
                            <th>State</th>
                            <th>Status</th>
                            <th>Edit</th>
                            <th>Change Status</th>
                        </tr>
                    </thead>
                    <tbody>
                        @if (ViewBag.GetStatesData == null)
                        {
                            <tr>
                                <td>Please Enter Some States Data</td>
                            </tr>
                        }
                        else
                        {
                            foreach (var item in ViewBag.GetStatesData)
                            {
                                <tr>
                                    <td>@item.State_Name</td>
                                    <td>@item.State_Status</td>
                                    <td>
                                        @{
                                using (@Html.BeginForm("EditState", "Admin", FormMethod.Post))
                                {
                                  
                                           <input type="hidden" name="State_Id" id="State_Id" value="@item.State_Id " />
                                            <input type="submit" class="btn btn-default btn-sm" name="" value="Edit " />

                                }
}
                                    </td>

                                    <td>
                                        @{
                                using (@Html.BeginForm("StateChangeStatus", "Admin", FormMethod.Post, new { @class = "form-horizontal" }))
                                {
                                     <input type="hidden" name="State_Id" id="State_Id" value="@item.State_Id " />
                                            <input type="submit" class="btn btn-default btn-sm" name="" value="Toggle " />

                                }
                                        }
                                    </td>

                                </tr>
                            }
                        }
                    </tbody>
                </table>
            </div><!-- /.table-responsive -->
        </div><!-- /.box-body -->
        <div class="box-footer clearfix">
            <a href="#" class="btn btn-sm btn-info btn-flat btn-success pull-left" data-toggle="modal" data-target="#AddState-modal">Add State</a>
            <a href="#" class="btn btn-sm  btn-flat pull-right">Cancel</a>
        </div><!-- /.box-footer -->
    </div><!-- /.box -->
</div>



<!---Modal--->

<div class="Add-State">
    <div class="modal modal-success modal fade" tabindex="-1" id="AddState-modal">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                    <h4 class="Add-State">Add States</h4>
                </div>

                @{
                    using (@Html.BeginForm("SaveState", "Admin", FormMethod.Post, new { @class = "form-horizontal" }))
                    {

                        <div class="modal-body">



                            <br />

                            <div class="form-group">
                                <label for="State-Name" class="col-sm-3 control-label">State Name</label>
                                <div class="col-sm-9">


                                    @Html.TextBoxFor(d => d.State_Name, new { @class = "form-control", @id = "State_Name" })
                                </div>
                            </div>

                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-outline btn-success pull-left " aria-hidden="true" data-dismiss="modal">Close</button>
                            @Html.HiddenFor(d => d.State_Id)
                            <button type="submit" class="btn btn-outline">Save changes</button>
                        </div>
                    }

                }
            </div>



            <!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->
</div>
